'''
word_convert_XML.py
将解析出的单词写成有道云词典的xml
'''
def word_convert_xml(word_list,xml_name):
    xml_file = open(xml_name,'w');
    xml_file.write('<wordbook>') #xml起始位置
    for word in word_list:
        xml_file.write('<item>')
        xml_file.write('    <word>' + word + '</word>\n')
        xml_file.write('    <trans>' + '<![CDATA[]]>' +  '</trans>\n')
        xml_file.write('    <tags>'+"usb-eye"+'</tags>\n') #reading是你单词本的名字，你可以改成自己的
        xml_file.write('    <progress>1</progress>\n')
        xml_file.write('</item>')
    xml_file.write('</wordbook>')#xml结束位置
# word_convert_xml(test_list,'d1.xml');
# print("单词个数:",len(test_list));
